package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.dao.AdminPlusDao;
import com.example.dao.AssessorPlusDao;
import com.example.entity.StudentInformation;
import com.example.service.AdminPlusService;
import com.example.service.AssessorPlusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 陈俊杰
 */
@Service
public class AssessorPlusServiceImpl extends ServiceImpl<AssessorPlusDao, StudentInformation> implements AssessorPlusService {

    @Autowired
    AssessorPlusDao dao;


    @Override
    public IPage<StudentInformation> getPage(Integer currentPage, Integer pageSize, StudentInformation info) {
            LambdaQueryWrapper<StudentInformation> lqw = new LambdaQueryWrapper<>();
            lqw.like(info.getStudentId()!=null, StudentInformation::getStudentId, info.getStudentId());
            lqw.like(info.getName()!=null, StudentInformation::getName, info.getName());
            lqw.like(info.getPhone()!=null, StudentInformation::getPhone, info.getPhone());
            lqw.like(info.getGreenCode()!=null, StudentInformation::getGreenCode, info.getGreenCode());
            IPage page = new Page(currentPage, pageSize);
            dao.selectPage(page, lqw);
            return page;
    }

    @Override
    public List<StudentInformation> getVoteName() {
        return dao.getVoteName();
    }


}
